Efficient Implementation of Run-time Generic Types for Java

نویسندگان

  • Eric E. Allen
  • Robert Cartwright
  • Brian Stoler
چکیده

We describe an efficient compiler and run-time system for NextGen, a compatible extension of the Java programming language supporting run-time generic types designed by Cartwright and Steele. The resulting system is comparable in performance with both standard Java and the GJ extension of Java, which does not support run-time generic types. Our implementation of NextGen consists of a compiler extending the GJ compiler and a special class loader that constructs type instantiation classes on demand. The compiler relies on the implementation strategy proposed by Cartwright and Steele with one major exception: to support polymorphic recursion in the definition of generic classes, the compiler generates templates for instantiation classes which are constructed on demand by the class loader. We include an extensive set of benchmarks, specifically developed to stress the use of generic types. The benchmarks show that the additional code required to support run-time generic types has little overhead compared with ordinary Java and GJ.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Efficient Implementation of First-class Polymorphic Methods in Java

This thesis describes a new implementation architecture for polymorphic methods in Generic Java using the NextGen compiler framework. The standard Generic Java (Java 1.5) compiler erases generic types at compilation. This transformation prohibits type-dependent operations, limiting generic expressivity. Type erasure causes unchecked warnings at compilation, and unexpected behavior or exceptions...

متن کامل

Generic Ownership: Practical Alias Control in Object-Oriented Programming Languages

Modern object-oriented languages support many techniques that simplify the work of a programmer. Among them is type genericity — an ability to create generic descriptions of algorithms and object structures that will be automatically specialised by supplying type information at run time. On the other hand, object-oriented technologies still suffer from bad effects of aliasing— a case of many ob...

متن کامل

Some Examples of Generics in Java 1.5

The forthcoming releases of Java JDK v1.5 and C# v2.0 support generic classes (classes with generic type parameters) and generic methods. Furthermore, each also supports constrained generic types. Much has been written about generic types. In " A Comparative Study of Language Support for Generic Programming " by Garcia et al details of generic types and programming in C++, Haskell, Standard ML,...

متن کامل

Generic operations and capabilities in the JR concurrent programming language

The JR concurrent programming language extends Java with additional concurrency mechanisms, which are built upon JR’s operations and capabilities. JR operations generalize methods in how they can be invoked and serviced. JR capabilities act as reference to operations. Recent changes to the Java language and implementation, especially generics, necessitated corresponding changes to the JR langua...

متن کامل

Genericity in Java with Virtual Types

This paper suggests virtual types for Java, a language mechanism which subsumes parameterized classes, while also integrating more naturally with Java’s object model. The same basic mechanism is also known as virtual patterns in Beta and as generics in Ada95. We discuss various issues in the Java type system, issues with inheritance and genericity in general, and give a specific suggestion as t...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2002